package UnitTest.AlgorithmTest.mathTest;

import Algorithm.math.NthPowerOfTwo;
import org.junit.Test;

/**
 * @author liujun
 * @version 1.0
 * @date 2021/1/6
 * @author—Email ljfirst@mail.ustc.edu.cn
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 判断一个数是不是2的N次方 测试案例
 */

public class NthPowerOfTwoTest {

    NthPowerOfTwo nthPowerOfTwo = new NthPowerOfTwo();

    @Test
    public void textNthPowerOfTwo() {
        assert nthPowerOfTwo.check(2);
        assert nthPowerOfTwo.check(4);
        assert !nthPowerOfTwo.check(6);
        assert nthPowerOfTwo.check(8);
        assert !nthPowerOfTwo.check(10);
        assert nthPowerOfTwo.check(16);
        assert nthPowerOfTwo.check(32);
        assert nthPowerOfTwo.check(64);
        assert nthPowerOfTwo.check(128);
        assert !nthPowerOfTwo.check(129);
        assert nthPowerOfTwo.check(256);
        assert nthPowerOfTwo.check(512);
        assert nthPowerOfTwo.check(1024);
        assert nthPowerOfTwo.check(2048);
        assert nthPowerOfTwo.check(4096);
    }
}
